﻿using MyExeSetting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyExe.Help
{
    public class FileTypeHelper
    {
        /// <summary>
        /// 判断文件类型  照片;视频;音频;其他
        /// </summary>
        /// <param name="fileExtension"></param>
        /// <returns></returns>
        public static string GetFileType(string fileExtension)
        {
            string strType = string.Empty;
            if (MyExeSettingHelper.Instance.Images.ToLower().Contains(fileExtension))
            {
                strType = "3";
            }
            else if (MyExeSettingHelper.Instance.Videos.ToLower().Contains(fileExtension))
            {
                strType = "1";
            }
            else if (MyExeSettingHelper.Instance.Audios.ToLower().Contains(fileExtension))
            {
                strType = "2";
            }
            else if (MyExeSettingHelper.Instance.Logs.ToLower().Contains(fileExtension))
            {
                strType = "4";
            }
            return strType;
        }

        /// <summary>
        /// 判断文件类型  照片;视频;音频;其他
        /// </summary>
        /// <param name="fileExtension"></param>
        /// <returns></returns>
        public static string GetFileTypeName(string fileExtension)
        {
            string strType = string.Empty;
            if (MyExeSettingHelper.Instance.Images.ToLower().Contains(fileExtension))
            {
                strType = "图片";
            }
            else if (MyExeSettingHelper.Instance.Videos.ToLower().Contains(fileExtension))
            {
                strType = "视频";
            }
            else if (MyExeSettingHelper.Instance.Audios.ToLower().Contains(fileExtension))
            {
                strType = "音频";
            }
            else if (MyExeSettingHelper.Instance.Logs.ToLower().Contains(fileExtension))
            {
                strType = "日志";
            }
            return strType;
        }
    }
}
